package com.group3.pojo.receive;

import com.group3.controller.Validated.Add;
import com.group3.controller.Validated.IdCard;
import com.group3.controller.Validated.Phone;
import com.group3.controller.Validated.Select;
import com.group3.pojo.Page;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import javax.validation.constraints.*;

/**
 * StudentReceive
 *
 * @author HY
 * 2021/06/12 16:17
 **/

@Data
@ToString
@ApiModel(value = "学生信息")
public class StudentReceive extends Page {

    @NotEmpty(message = "班级怎么能为空呢？", groups = {Add.class, Select.class})
//    @NotEmpty(message = "查询班级学生班级怎么能为空呢？", groups = Select.class)
    @ApiModelProperty(value = "学生班级", required = true)
    private String classId;

    @NotEmpty(message = "学生姓名怎么能为空呢？", groups = Add.class)
    @ApiModelProperty(value = "学生姓名", required = true)
    private String studentName;

    @NotEmpty(message = "学生学号怎么能为空呢？", groups = Add.class)
    @ApiModelProperty(value = "修改后的学生学号", required = true)
    private String studentId;

    @NotEmpty(message = "学生学号怎么能为空呢？")
    @ApiModelProperty(value = "修改前的学生学号", required = true)
    private String beforeStudentId;

    @NotEmpty(message = "学生身份证怎么能为空呢？", groups = Add.class)
//    简单身份验证   15位或18位
//    @Pattern(regexp = "(^\\d{18}$)|(^\\d{15}$)",
//            message = "身份证格式有问题哦")
    @IdCard(message = "身份证格式有问题哦", groups = Add.class)
    @ApiModelProperty(value = "学生身份证", required = true)
    private String cardId;

    @NotEmpty(message = "学生性别怎么能为空呢？", groups = Add.class)
    @Max(value = 1, message = "是否结业只能为0或1", groups = Add.class)
    @Min(value = 0, message = "是否结业只能为0或1", groups = Add.class)
    @ApiModelProperty(value = "学生性别", required = true)
    private Integer sex;

    @NotEmpty(message = "学生邮箱怎么能为空呢？", groups = Add.class)
//    @Pattern(regexp = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$",
//            message = "学生邮箱有问题哦")
    @Email(message = "学生邮箱有问题哦", groups = Add.class)
    @ApiModelProperty(value = "学生邮箱", required = true)
    private String email;

    @NotEmpty(message = "学生电话怎么能为空呢？", groups = Add.class)
    @Phone(message = "电话格式有问题哦")
    @ApiModelProperty(value = "学生电话", required = true)
    private String tel;

    @NotEmpty(message = "项目角色怎么能为空呢？", groups = Add.class)
    @ApiModelProperty(value = "项目角色", required = true)
    private Integer type;
}
